﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace SpaceKinect.Screens
{
    class CreditScreen : GameScreen
    {
        #region Initialization


        /// <summary>
        /// The constructor of credit Screen
        /// </summary>
        private CreditScreen(ScreenManager screenManage)
        {
        }


        /// <summary>
        /// Activates the loading screen.
        /// </summary>
        public static void Load(ScreenManager screenManager, PlayerIndexEventArgs e)
        {

            // Create and activate the loading screen.
            CreditScreen loadingScreen = new CreditScreen(screenManager);

            screenManager.AddScreen(loadingScreen,e.PlayerIndex);
        }


        #endregion

        #region Update and Draw


        /// <summary>
        /// Draws the loading screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
           //Displaying our names in the credit
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;
            SpriteFont font = ScreenManager.Font;
            const string project = "Space Kinect Game";
            const string progamming = " Progammers";
            const string names = " Braeden Paradine" + "\n Brett Saddleton" + "\n Chris Lloyd" + "\n Matthew Law" + "\n Mohammed Nasser" + 
                "\n Steven Crake" + "\n Steffan Safey";
            // Center the text in the viewport.
            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
            Vector2 viewportSize = new Vector2(viewport.Width, viewport.Height);
            Vector2 textSize = font.MeasureString(project);
            Vector2 textPosition = (viewportSize - textSize) / 2;
            float x = textPosition.X;
            float y = textPosition.Y - 180;
            Vector2 namespos = new Vector2(x, y);
            Vector2 programeTitle = new Vector2(x, y-100);
            Color color = Color.White * TransitionAlpha;

            // Draw the text.
            spriteBatch.Begin();
            spriteBatch.DrawString(font, names, namespos, color);
            spriteBatch.DrawString(font, progamming, programeTitle, color);
            spriteBatch.End();
        }

        public override void HandleInput(InputState input)
        {
            PlayerIndex playerIndex;
            if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
            {
                ExitScreen();
            }
        }

        #endregion
    }

}